<app-left-line [text]="'电子合同'"></app-left-line>

<div class="e-contract">
  <div class="my-list-header">
    
  </div>

  <div class="contract-content card">
    <nz-spin [nzSpinning]="nzSpinning">
      <nz-table #borderedTable nzBordered nzSize="small" [nzData]="dataSet" 
        [nzShowPagination]="false" 
        [nzLoading]="nzLoading"
        [nzNoResult]="tableEmpty"
      >
        <thead>
          <tr>
            <th>序号</th>
            <th *ngFor="let col of cols | dealObj: 'value'">{{ col }}</th>
            <th>操作</th>
          </tr>
        </thead>
        <tbody>
          <tr *ngFor="let data of dataSet; let i = index">
            <td>{{ i + 1 }}</td>
            <td>{{ data['funcNo'] }}</td>
            <td>{{ funcType[data['funcType']].value }}</td>
            <td>{{ isCitizen[data['isCitizen']].value }}</td>
            <td>
              <nz-tag [nzColor]="state[data['state']].color">
                {{ state[data['state']].value }}
              </nz-tag>
            </td>
            <td>{{ data['createTime'] }}</td>
            <td>{{ data['signTime'] ? data['signTime'] : '-' }}</td>
            <td>
              <a (click)="viewContract(data)">查看合同并签署</a>&nbsp;&nbsp;
            </td>
          </tr>
        </tbody>
      </nz-table>

      <ng-template #tableEmpty>
        <nz-empty nzNotFoundImage="simple" [nzNotFoundContent]="'报装业务处理完成后，由增城自来水推送电子合同，请留意系统通知。当前暂无待签署合同'"></nz-empty>
      </ng-template>
    </nz-spin>
  </div>
  <div class="my-pagination">
    <nz-pagination 
      [nzShowTotal]="totalTemplate" 
      nzShowSizeChanger 
      [nzPageSizeOptions]="pageSizeOptions"
      [nzTotal]="nzTotal" 
      [(nzPageSize)]="nzPageSize" 
      [(nzPageIndex)]="nzPageIndex"
      (nzPageSizeChange)="getContractList()" 
      (nzPageIndexChange)="getContractList()">
    </nz-pagination>
    <ng-template #totalTemplate let-total>共 {{ nzTotal }} 条</ng-template>
  </div>
</div>

<app-pdf-preview 
  [title]="'电子合同'"
  [(nzVisible)]="modalIsVisible" 
  [pdfId]="pdfId"
  [okBtnText]="okBtnText"
  (onOkBtn)="modalHandleOk(okBtnText)"
></app-pdf-preview>

<app-my-sign [(nzVisible)]="signVisible"
  (onOK)="sign($event)"
></app-my-sign>